#pragma once
#pragma warning(disable:4996)       // disable checked iterator errors http://msdn.microsoft.com/en-us/library/aa985965(VS.80).aspx 

//
// Copyright (C) 2011 - 2013 Steve Channell steve.channell@cepheis.com
//
// This file is part of Cephei.QL, an open-source library wrapper 
// arround QuantLib http://quantlib.org/
//
// Cephei.QL is open source software: you can redistribute it and/or modify it
// under the terms of the license.  You should have received a
// copy of the license along with this program; if not, please email
// <support@cepheis.com>. The license is also available online at
// <http://cepheis.com/license.htm>.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE.  See the license for more details.
//
// Version 2.2 with QuantLib 1.2.1

#include <Macros.h>
#include <ValueHelpers.h>
#include <Settings.h>

#include <gen/QL/Quote.h>
#pragma unmanaged 
#include <ql\experimental\fx\deltavolquote.hpp>
#include <boost/smart_ptr/detail/spinlock.hpp>
#pragma managed 

using namespace System;
using namespace QuantLib;
using namespace Cephei;
using namespace Cephei::Core;
using namespace PLATFORM::Collections;

using namespace Cephei::QL;
#define HANDLE
#undef ABSTRACT
#undef STRUCT
namespace Cephei { namespace QL { namespace Experimental { namespace Fx {
	//////////////////////////////////////////////////////////////////////////////////////////////
	// implementation of IDeltaVolQuote
	public ref class CDeltaVolQuote  : 
            public CQuote,
            public Cephei::QL::Experimental::Fx::IDeltaVolQuote
	{
	protected: 
		boost::shared_ptr<QuantLib::DeltaVolQuote>* _ppDeltaVolQuote;
#ifdef HANDLE
		QuantLib::Handle<QuantLib::DeltaVolQuote>* _phDeltaVolQuote;
#endif
		Object^ _DeltaVolQuoteOwner;     // reference to object that manages the storage for this object
	internal:
		CDeltaVolQuote (Cephei::QL::IQuote^ vol, QL::Experimental::Fx::DeltaVolQuote::DeltaTypeEnum deltaType, Double maturity, QL::Experimental::Fx::DeltaVolQuote::AtmTypeEnum atmType);
		CDeltaVolQuote (Double delta, Cephei::QL::IQuote^ vol, Double maturity, QL::Experimental::Fx::DeltaVolQuote::DeltaTypeEnum deltaType);
        CDeltaVolQuote (boost::shared_ptr<QuantLib::DeltaVolQuote>& childNative, Object^ owner);
        CDeltaVolQuote (QuantLib::DeltaVolQuote& childNative, Object^ owner);
        CDeltaVolQuote (CDeltaVolQuote^ copy);
        CDeltaVolQuote (PLATFORM::Type^ t);
#ifdef STRUCT
        CDeltaVolQuote (QuantLib::DeltaVolQuote childNative);
#endif       
#ifdef HANDLE
		CDeltaVolQuote (QuantLib::Handle<QuantLib::DeltaVolQuote>& childNative, Object^ owner);
		CDeltaVolQuote (QuantLib::Handle<QuantLib::DeltaVolQuote> childNative);
#endif
		virtual ~CDeltaVolQuote ();
		!CDeltaVolQuote ();

	internal:
		QuantLib::DeltaVolQuote& GetReference ();
		boost::shared_ptr<QuantLib::DeltaVolQuote>& GetShared ();
		QuantLib::DeltaVolQuote* GetPointer ();
        void SetDeltaVolQuote (boost::shared_ptr<QuantLib::DeltaVolQuote> native)
        {
            if (_ppDeltaVolQuote != NULL)
                delete _ppDeltaVolQuote;
            _ppDeltaVolQuote = new boost::shared_ptr<QuantLib::DeltaVolQuote> (native);
            SetQuote (boost::dynamic_pointer_cast<QuantLib::Quote> (*_ppDeltaVolQuote));
        }
#ifdef HANDLE
		QuantLib::Handle<QuantLib::DeltaVolQuote>& GetHandle ();
#endif
		virtual bool HasNative () override;
    public:
        property QL::Experimental::Fx::DeltaVolQuote::AtmTypeEnum AtmType 
        {
		    virtual QL::Experimental::Fx::DeltaVolQuote::AtmTypeEnum get () ;
        }
        property Double Delta 
        {
		    virtual Double get () ;
        }
        property QL::Experimental::Fx::DeltaVolQuote::DeltaTypeEnum DeltaType 
        {
		    virtual QL::Experimental::Fx::DeltaVolQuote::DeltaTypeEnum get () ;
        }
        property Boolean IsValid 
        {
		    virtual Boolean get () ;
        }
        property Double Maturity 
        {
		    virtual Double get () ;
        }
        property Cephei::QL::Experimental::Fx::IDeltaVolQuote^ Update 
        {
		    virtual Cephei::QL::Experimental::Fx::IDeltaVolQuote^ get () ;
        }
        property Double Value 
        {
		    virtual Double get () ;
        }
    };
	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Factory class
//z	[FactoryFor(Core::Generic::ICoCell<Cephei::QL::Experimental::Fx::IDeltaVolQuote^>::typeid)]
	[FactoryFor(Cephei::QL::Experimental::Fx::IDeltaVolQuote::typeid)]
	[FactoryFor(Cephei::QL::Experimental::Fx::IDeltaVolQuote_Factory::typeid)]
	public ref class CDeltaVolQuote_Factory sealed : public IDeltaVolQuote_Factory
	{
	public:
        virtual IDeltaVolQuote^ Create (Cephei::QL::IQuote^ vol, QL::Experimental::Fx::DeltaVolQuote::DeltaTypeEnum deltaType, Double maturity, QL::Experimental::Fx::DeltaVolQuote::AtmTypeEnum atmType);
        virtual IDeltaVolQuote^ Create (Double delta, Cephei::QL::IQuote^ vol, Double maturity, QL::Experimental::Fx::DeltaVolQuote::DeltaTypeEnum deltaType);
    };
   
/*Cephei*/ } /*QL*/ } /*Experimental*/ } /*Fx */}
